﻿<phone:PhoneApplicationPage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:c="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:tk="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                            xmlns:vms="clr-namespace:GooNews.ViewModels"
                            xmlns:GooNews_Controls="clr-namespace:GooNews.Controls"
                            xmlns:ctrls="clr-namespace:GooNews.Controls"
                            xmlns:phoney="clr-namespace:AgiliTrain.PhoneyTools.Controls;assembly=AgiliTrain.PhoneyTools"
                            x:Class="GooNews.Pages.OptionsPage"
                            SupportedOrientations="PortraitOrLandscape"
                            mc:Ignorable="d"
                            Orientation="Portrait"
                            d:DesignHeight="768"
                            d:DesignWidth="480"
                            shell:SystemTray.IsVisible="True">
  <phone:PhoneApplicationPage.Resources>
    <DataTemplate x:Key="builtInFeedTemplate">
      <phoney:SelectSwitch Margin="8 2"
                           IsSelected="{Binding Enabled, Mode=TwoWay}"
                           SelectedChanged="SelectSwitch_SelectedChanged"
                           IndicatorBrush="{StaticResource appAccentBrush}"
                           TextIndicatorFontFamily="Segoe WP SemiLight"
                           TextIndicatorFontStretch="ExtraCondensed"
                           TextIndicatorBrush="{StaticResource foreBrush}"
                           d:DesignWidth="350"
                           d:DesignHeight="102"
                           Style="{StaticResource theSelectSwitch}">
        <TextBlock Text="{Binding Title}"
                   FontSize="{StaticResource PhoneFontSizeLarge}"
                   Foreground="{StaticResource foreBrush}"
                   VerticalAlignment="Center" />
      </phoney:SelectSwitch>
    </DataTemplate>
    <DataTemplate x:Key="searchFeedTemplate">
      <Grid d:DesignWidth="291"
            d:DesignHeight="61">
        <Grid.ColumnDefinitions>
          <ColumnDefinition />
          <ColumnDefinition Width="150" />
        </Grid.ColumnDefinitions>
        <TextBlock TextWrapping="Wrap"
                   Text="{Binding Title}"
                   FontSize="{StaticResource PhoneFontSizeLarge}"
                   Margin="{StaticResource PhoneMargin}" />
        <Button Grid.Column="1"
                Content="Remove"
                Click="deleteButton_Click"
                FontSize="18.667"
                Foreground="{StaticResource foreBrush}"
                BorderBrush="{StaticResource foreBrush}" />
      </Grid>
    </DataTemplate>
  </phone:PhoneApplicationPage.Resources>
  <phone:PhoneApplicationPage.FontFamily>
    <StaticResource ResourceKey="PhoneFontFamilyNormal" />
  </phone:PhoneApplicationPage.FontFamily>
  <phone:PhoneApplicationPage.FontSize>
    <StaticResource ResourceKey="PhoneFontSizeNormal" />
  </phone:PhoneApplicationPage.FontSize>
  <phone:PhoneApplicationPage.Foreground>
    <StaticResource ResourceKey="foreBrush" />
  </phone:PhoneApplicationPage.Foreground>
  <Grid x:Name="LayoutRoot"
        Background="{StaticResource backgroundBrush}">
    <Grid.RowDefinitions>
      <RowDefinition Height="34" />
      <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <ctrls:AppHeader />
    <c:Pivot Foreground="{StaticResource foreBrush}"
             Grid.Row="1">
      <c:Pivot.HeaderTemplate>
        <DataTemplate>
          <TextBlock Margin="0 -25"
                     Text="{Binding}"
                     FontSize="72" />
        </DataTemplate>
      </c:Pivot.HeaderTemplate>
      <c:PivotItem Header="standard">
        <ScrollViewer>
          <StackPanel>
            <TextBlock Text="Google News Source"
                       Foreground="{StaticResource foreBrush}" />
            <tk:ListPicker ItemsSource="{Binding Neds}"
                           SelectedItem="{Binding CurrentNed, Mode=TwoWay}"
                           FullModeHeader="Google News Source"
                           BorderThickness="{StaticResource PhoneBorderThickness}"
                           DisplayMemberPath="Name">
              <tk:ListPicker.FullModeItemTemplate>
                <DataTemplate>
                  <TextBlock Text="{Binding Name}"
                             FontSize="32"
                             Margin="0 12"
                             FontFamily="{StaticResource PhoneFontFamilyLight}" />
                </DataTemplate>
              </tk:ListPicker.FullModeItemTemplate>
            </tk:ListPicker>
            <TextBlock Text="Standard Feeds"
                       Foreground="{StaticResource foreBrush}" />
            <ItemsControl x:Name="builtInFeedList"
                          ItemsSource="{Binding BuiltInFeedTypes}"
                          ItemTemplate="{StaticResource builtInFeedTemplate}"
                          MinHeight="50"
                          Foreground="{StaticResource foreBrush}" />
          </StackPanel>
        </ScrollViewer>
      </c:PivotItem>
      <c:PivotItem Header="search">
        <ScrollViewer Foreground="{StaticResource foreBrush}">
          <StackPanel>
            <ItemsControl x:Name="customFeedList"
                          ItemsSource="{Binding SearchFeedTypes}"
                          ItemTemplate="{StaticResource searchFeedTemplate}"
                          MinHeight="50"
                          Foreground="{StaticResource foreBrush}" />
            <StackPanel>
              <phoney:ClearableTextBox x:Name="searchFeedBox"
                                       TextWrapping="Wrap"
                                       InputScope="Text"
                                       KeyUp="searchFeedBox_KeyUp" />
              <Button Content="Add Feed"
                      FontSize="{StaticResource PhoneFontSizeNormal}"
                      HorizontalAlignment="Right"
                      x:Name="addButton"
                      Width="199"
                      Foreground="{StaticResource foreBrush}"
                      BorderBrush="{StaticResource foreBrush}" />
            </StackPanel>
          </StackPanel>
        </ScrollViewer>
      </c:PivotItem>
      <c:PivotItem Header="accounts">
        <ScrollViewer Foreground="{StaticResource foreBrush}">
          <StackPanel>
            <TextBlock Text="InstaPaper UserName"
                       Foreground="{StaticResource foreBrush}" />
            <phoney:ClearableTextBox Text="{Binding InstaPaperUserName, Mode=TwoWay}"
                                     InputScope="EmailNameOrAddress"
                                     x:Name="instaPaperUserTextBox"
                                     KeyUp="instaPaperUserTextBox_KeyUp" />
            <TextBlock Text="InstaPaper Pwd"
                       Foreground="{StaticResource foreBrush}" />
            <PasswordBox Password="{Binding InstaPaperPassword, Mode=TwoWay}"
                         x:Name="instaPaperPasswordBox"
                         KeyUp="instaPaperPasswordBox_KeyUp" />
            <Grid Height="69"
                  Width="456">
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
              </Grid.ColumnDefinitions>
              <TextBlock x:Name="testStatusBlock"
                         d:LayoutOverrides="Height"
                         FontFamily="{StaticResource PhoneFontFamilyLight}"
                         FontSize="{StaticResource PhoneFontSizeSmall}"
                         Margin="12"
                         Foreground="{StaticResource foreBrush}" />
              <Button Content="Test Credentials"
                      x:Name="testLoginButton"
                      Click="testLoginButton_Click"
                      d:LayoutOverrides="Height"
                      FontSize="{StaticResource PhoneFontSizeNormal}"
                      Grid.Column="1"
                      Foreground="{StaticResource foreBrush}"
                      BorderBrush="{StaticResource foreBrush}" />
            </Grid>
            <TextBlock TextWrapping="Wrap"
                       Foreground="{StaticResource foreBrush}"><Run Text="To disable Instapaper, just erase username." /></TextBlock>
          </StackPanel>
        </ScrollViewer>
      </c:PivotItem>
    </c:Pivot>
  </Grid>
</phone:PhoneApplicationPage>
